package com.example.myaop.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//注册拦截器
@Component
public class Interceptor implements WebMvcConfigurer {
    @Autowired
    public UserInter userInter;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("拦截器运行");
        registry.addInterceptor(userInter)
                .addPathPatterns("/**")
                .excludePathPatterns("/login.html")
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/img/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/editor.md/**")
                .excludePathPatterns("/user/log");
    }
}
